﻿#region 命名空间

using System;
using System.Collections.Generic;

using Sharp.DataTransferObject;
using Sharp.Infrastructure;

using System.Threading.Tasks;
using Sharp.Infrastructure.Interfaces;
using Sharp.DataTransferObject.Query;

#endregion

namespace Sharp.ServiceContracts
{
    public partial interface IUserService
    {
        /// <summary>
        ///     全部权限
        /// </summary>
        /// <returns></returns>


        Task<IEnumerable<PermissionDTO>> AllPermissions();
        /// <summary>
        /// 全部可用权限
        /// </summary>
        /// <returns></returns>


        Task<IEnumerable<PermissionDTO>> AllAvailablePermissions();

        /// <summary>
        /// 获取角色权限
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>


        Task<IEnumerable<PermissionDTO>> GetPermissionByRoleId(int roleId);


        /// <summary>
        ///     保存权限
        /// </summary>
        /// <param name="ids">被勾选的权限列表</param>
        /// <param name="owner">所有者</param>
        /// <param name="ownerId">所有者id</param>
        /// <remarks>通过所有者来判断具体是给用户或者用户组进行权限配置</remarks>
        /// <returns></returns>


        Result SavePermission([ToBody]IList<Guid> ids, [ToUri]string owner, [ToUri]int ownerId);

        /// <summary>
        ///     获取用户的权限
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>

        [ContractTag(Tag = ContractTagEnum.AllowAnonymous)]
        Task<IEnumerable<PermissionDTO>> GetPermissionById(int userId);

        /// <summary>
        /// 更新权限库
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [ContractTag(Tag = ContractTagEnum.AllowAnonymous)]
        Result RefurbishAvailablePermissionData(PermissionDataQuery query);

        /// <summary>
        /// 分配所有权限给超级管理员角色
        /// </summary>
        /// <returns></returns>
        /// <remarks>初始化系统的用的功能</remarks>
        [ContractTag(Tag = ContractTagEnum.AllowAnonymous)]
        Result AllotAllPermissionToAdminRole();
        /// <summary>
        /// 保存可用权限到权限列表
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>


        Result AvailablePermissionToPermission(Guid[] ids);

        /// <summary>
        /// 保存组织结构数据权限
        /// </summary>
        /// <returns></returns>


        Result SaveOrgPermission(Guid[] orgIds, [ToUri] int roleId);

    }
}